package homework;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Scanner;

public class Exercise01 {
    public static void main(String[] args) throws ParseException {
        System.out.println("请输入员工的入职日期，格式为“xxxx年xx月xx日”：");
        Scanner scanner = new Scanner(System.in);
        String entryTime = scanner.nextLine();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        long entryMseconds = sdf.parse(entryTime).getTime();
        long diffMseconds = System.currentTimeMillis() - entryMseconds;

        int year = (int) (diffMseconds / (1000 * 60 * 60 * 24) / 365);
        System.out.println("该员工已入职满" + year + "年");
    }
}
